<?php
	function getField($name) {
		
		if(isset($_POST[$name])) {
			return $_POST[$name];
		}
		else {
			return "<value not set>";
		}		
	}
	
	
	function getCheckboxfields($name) {
		
		$res = $_POST[$name];

        //echo("languages chosen: " . count($lang) . "<br><br>");

        /*if (count($lang)>0) {
            echo("You chose the following languages:<br>");
        }*/
		$result = "";

        for ($i=0; $i<count($res); $i++) {
			$result = $result . "<br>" . $res[$i];
        }
        return $result;
	}

?>
<html>
<body>
<p>
	<b>You entered:</b>
</p>
<p>
	<b>First name : </b><?php echo getField('first');?><br>
	<b>Last name : </b><?php echo getField('last');?><br> 
	<b>Password  : </b><?php echo getField('pwd');?><br>
	<b>Gender : </b><?php echo getField('gender');?><br>
	<b>Language skills : </b><?php echo getCheckboxfields('language');?><br>
	<b>Car brand : </b><?php echo getField('cars');?><br>
	<b>Note : </b><?php echo getField('note');?><br>
	<br><br>
	<br>
	<p><a href="form.html">Try again</a></p>
	<p><a href="index.html">Home</a></p>
</p>
</body>
</html>